#!/bin/sh
rm *.ks
echo "Creating KeyStore Server"
keytool -keystore serverkeys.ks -genkeypair -alias server -keyalg RSA -sigalg SHA1WithRSA
echo "Creating KeyStore Client"
keytool -keystore clientkeys.ks -genkeypair -alias client -keyalg RSA -sigalg SHA1WithRSA 

echo "Exporting Client Cert from KeyStore Client"
keytool -export -keystore clientkeys.ks -alias client -rfc -file client.cer
echo "Exporting Server Cert from KeyStore Server"
keytool -export -keystore serverkeys.ks -alias server -rfc -file server.cer
echo "Importing Server Cert into Trustore Client"
keytool -import -file server.cer -keystore clienttrust.ks -alias client
echo "Importing Client Cert into Trustore Server"
keytool -import -file client.cer -keystore servertrust.ks -alias server
rm *.cer
